/*
 * Copyright (c) 18/5/25 . All Rights Reserved.
 */
package com.cgmnx.admin.web.converter.entity;

import com.cgmnx.admin.common.bean.Limiter;
import com.cgmnx.admin.dao.condition.NoteCondition;
import com.cgmnx.admin.model.enums.ReplyAuditStatus;
import com.cgmnx.admin.web.converter.Convert;
import com.cgmnx.admin.web.model.param.NoteQueryParam;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * @author: z Date: 18/5/25 Time: 下午5:09
 * @version: 1.0.0
 */
@Component
public class NoteConditionConverter implements Convert<NoteQueryParam,NoteCondition> {
    @Override
    public NoteCondition convert(NoteQueryParam param) {

        Limiter limiter = Limiter.create(param.getPageNum(), param.getPageSize());
        Date startDate = param.getStartDate()!=null ? new Date(param.getStartDate()):null;
        Date endDate = param.getStartDate()!=null ? new Date(param.getEndDate()):null;
        return new NoteCondition(param.getId(),param.getUserName(),
                param.getStatus(),startDate
                ,endDate,limiter);
    }

    @Override
    public List<NoteCondition> convert(List<NoteQueryParam> t) {
        throw new UnsupportedOperationException();
    }
}
